/* MarkdownRenderer Styles */
.markdown-renderer {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

/* Headers */
.markdown-h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8e8e8;
}

.markdown-h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 20px 0 12px;
}

.markdown-h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 16px 0 8px;
}

.markdown-h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 14px 0 8px;
}

.markdown-h5 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 0 6px;
}

.markdown-h6 {
  font-size: 14px;
  font-weight: 600;
  margin: 10px 0 6px;
}

/* Paragraphs */
.markdown-p {
  margin: 12px 0;
}

/* Lists */
.markdown-ul,
.markdown-ol {
  margin: 12px 0;
  padding-left: 24px;
}

.markdown-li {
  margin: 4px 0;
}

.markdown-ul .markdown-li {
  list-style-type: disc;
}

.markdown-ol .markdown-li {
  list-style-type: decimal;
}

/* Blockquote */
.markdown-blockquote {
  margin: 16px 0;
  padding: 8px 16px;
  border-left: 4px solid #1890ff;
  background: #f6f8fa;
  color: #6a737d;
}

/* Code */
.inline-code {
  padding: 2px 6px;
  margin: 0 2px;
  background: #f6f8fa;
  border-radius: 3px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  color: #e83e8c;
}

.code-block-wrapper {
  margin: 16px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #2d2d2d;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #1e1e1e;
  border-bottom: 1px solid #3e3e3e;
}

.code-language {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  font-weight: 500;
}

.code-copy-button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid #3e3e3e;
  border-radius: 4px;
  color: #999;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.code-copy-button:hover {
  background: #3e3e3e;
  color: #fff;
}

/* Tables */
.markdown-table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e8e8e8;
}

.markdown-th,
.markdown-td {
  padding: 8px 12px;
  border: 1px solid #e8e8e8;
  text-align: left;
}

.markdown-th {
  background: #fafafa;
  font-weight: 600;
}

.markdown-tr:nth-child(even) {
  background: #fafafa;
}

/* Links */
.markdown-link {
  color: #1890ff;
  text-decoration: none;
  transition: color 0.2s;
}

.markdown-link:hover {
  color: #40a9ff;
  text-decoration: underline;
}

/* Images */
.markdown-img {
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 4px;
}

/* Horizontal Rule */
.markdown-hr {
  margin: 24px 0;
  border: none;
  border-top: 1px solid #e8e8e8;
}

/* Mobile styles */
@media (max-width: 767px) {
  .markdown-renderer {
    font-size: 16px; /* Prevent iOS auto-zoom */
    line-height: 1.7; /* Better readability */
  }

  .markdown-h1 {
    font-size: 24px;
    margin: 20px 0 12px;
  }

  .markdown-h2 {
    font-size: 20px;
    margin: 16px 0 10px;
  }

  .markdown-h3 {
    font-size: 18px;
    margin: 14px 0 8px;
  }

  .markdown-h4 {
    font-size: 17px;
  }

  .markdown-h5 {
    font-size: 16px;
  }

  .markdown-h6 {
    font-size: 15px;
  }

  .markdown-p {
    margin: 10px 0;
  }

  .markdown-ul,
  .markdown-ol {
    padding-left: 20px;
  }

  /* Code blocks - horizontal scrolling */
  .code-block-wrapper {
    font-size: 14px;
    margin: 12px -16px; /* Extend to edges on mobile */
    border-radius: 0;
  }

  .code-block-header {
    padding: 6px 12px;
  }

  .code-language {
    font-size: 11px;
  }

  /* Touch-friendly copy button */
  .code-copy-button {
    min-height: 32px;
    min-width: 64px;
    padding: 6px 10px;
    font-size: 13px;
  }

  /* Tables - horizontal scrolling */
  .markdown-table-wrapper {
    margin: 12px -16px; /* Extend to edges */
    padding: 0 16px;
  }

  .markdown-th,
  .markdown-td {
    padding: 10px 12px;
    font-size: 15px;
  }

  /* Touch-friendly links */
  .markdown-link {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    padding: 0 4px;
  }

  /* Images */
  .markdown-img {
    margin: 12px 0;
    border-radius: 8px;
  }

  /* Blockquote */
  .markdown-blockquote {
    margin: 12px 0;
    padding: 8px 12px;
    font-size: 15px;
  }

  /* Inline code */
  .inline-code {
    font-size: 14px;
    padding: 3px 6px;
  }
}